﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using DbMapping.Common;
using Fsb.Utility;
using VideoCache.Server.BLL;
using VideoCache.Server.Model;
using VideoCache.Server.MVCWeb.Areas.Member.Models;
using VideoCache.Server.MVCWeb.Attributes;

namespace VideoCache.Server.MVCWeb.Areas.Member.Controllers
{
    [ActionAuthorize(AuthorizeType.Member)]
    public class HomeController : Controller
    {
        //
        // GET: /Member/Home/
        public ActionResult Index()
        {
            HomeModel model = new HomeModel();

            UserInfo info = UserBLL.GetUserByName(HttpContext.User.Identity.Name);

            if (info == null) return HttpNotFound();

            model.UserInfo = info;

            if (RoleBLL.IsUserInRole(info.Id, "netbar"))
            {
                NetbarInfo netbar = NetbarBLL.GetNetbarByUserId(info.Id);
            }

            if (RoleBLL.IsUserInRole(info.Id, "agent"))
            {
                AgentInfo netbar = AgentBLL.GetAgentByUserId(info.Id);
            }

            return View(model);
        }
    }
}